What is Abstract class and Interface in Java ?
Abstract class
720
09-Jul-2018
Prakash nidhi Verma
10-Jul-2018Abstract class and Interface in Java :
Declaration:
Abstract class is declared using 'abstract' keyword .Interface is declared using 'interface' keyword .
Methods:
Abstract class may contain abstract or concrete methods We can define abstract, default and static methods in an Interface.Access modifiers
Implementation:
Abstract class can not be instantiated but can be extended.Interface can be implemented by another class or can be extended by other interfaces Multiple inheritance.
difference feild is shown below :
- Methods
- Members
- Inheritance
- Member variables
- Members visibility
- Keyword
- main() exists
- Flexibility
Example :
1. Abstract class
2. Interface